package com.rongc.client.freight.business.carrier.view.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.rongc.client.core.utils.ActivityUtils;
import com.rongc.client.core.utils.StringUtils;
import com.rongc.client.freight.R;
import com.rongc.client.freight.base.BaseFragment;
import com.rongc.client.freight.business.supply.model.SupplyBean;
import com.rongc.client.freight.business.supply.view.activity.ComplaintsActivity;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by Bruce on 2017/07/14.
 */
public class ConveyanceDetailFragment extends BaseFragment implements View.OnClickListener{
    @Bind(R.id.tv_detail_date)
    TextView mTvDate;
    @Bind(R.id.tv_detail_supply)
    TextView mTvSupplyName;
    @Bind(R.id.tv_detail_model)
    TextView mTvModel;
    @Bind(R.id.tv_detail_weights)
    TextView mTvWeight;
    @Bind(R.id.tv_detail_dilk)
    TextView mTvDulk;
    @Bind(R.id.tv_detail_message)
    TextView mTvMessage;

    String sourceId;
    String fk_id;


    public static ConveyanceDetailFragment getInstance(){
        ConveyanceDetailFragment fragment = new ConveyanceDetailFragment();
        Bundle bdl = new Bundle();
//        bdl.putString("orderType", orderType);
        fragment.setArguments(bdl);
        return fragment;
    }

    public void setData(SupplyBean supplyBean){
        mTvDate.setText(supplyBean.getLoadTime());
        mTvSupplyName.setText(supplyBean.getGoods());
        mTvModel.setText(StringUtils.getNewModel(getActivity(),supplyBean.getCarLength(),supplyBean.getWeights(),supplyBean.getDilk(),supplyBean.getCarModels()));
        mTvWeight.setText(supplyBean.getWeights());
        mTvDulk.setText(supplyBean.getDilk());
        mTvMessage.setText(supplyBean.getMessage());
        sourceId = supplyBean.getId();
        fk_id = supplyBean.getUserId();
    }

    @OnClick({R.id.tv_complaints})
    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tv_complaints:
                Bundle bundle = new Bundle();
                bundle.putString("sourceId",sourceId);
                bundle.putString("fk_id",fk_id);
                ActivityUtils.startActivity(getActivity(), ComplaintsActivity.class,bundle);
                break;
        }
    }

    @Override
    public void initData() {
    }

    @Override
    public void initListener() {

    }


    @Override
    public void initView() {

    }


    @Override
    public int getLayoutId() {
        return R.layout.fragment_supply_detail;
    }
}
